#include<stdio.h>
//#include<conio.h>
int a[50],n,i,j,k;
int main()
{
    int ch;
   printf("enter length of Array=");
    scanf("%d",&n);
    if (n==0)
    {printf("enter valid length!!!"); }
    else
{
printf("list functions using arrays");
printf("\nenter your choice");
printf("\n1. reversing array");
printf("\n2. counting number of elements in array");
printf("\n3. searching in array \n");
scanf("%d",&ch); 
switch (ch)
{
case 1: rev();
	break;
case 2: count();
	break;
case 3: search();
	break;
default: printf("enter a valid choice");
}
}
}
int rev()
{
for(i=0;i<n;i++)
{
printf("enter element=");
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
printf(" %d ",a[i]);
}
printf("\n reverse of array=\n ");
for(j=n;j>0;j--)
{
printf(" %d ",a[--i]);
}
return 0;
}
int count()
{
printf("number of elements in array= %d \n",n);
return 0;
}

int search()
{
for(i=0;i<n;i++)
{
printf("enter element=");
scanf("%d",&a[i]);
}

int ele,temp=0;
printf("Enter the element to be search\n");
     scanf("%d",&ele);
for (i=0; i<5; i++)
     {
         if (a[i]==ele)
         {
           temp=1;
           printf("Element found %d , position=%d\n",ele,i);
         }
      }
       if (!temp)
       	printf("Element not found\n");  
 return 0;   
}
